import { Text, type TextProps, StyleSheet } from 'react-native'
import { useThemeColor } from '@/hooks/useThemeColor'
import { Fonts } from '@/constants/Themes'

export type ThemedTextProps = TextProps & {
  lightColor?: string
  darkColor?: string
  type?: keyof typeof Fonts
}

export function ThemedText({
  style,
  lightColor,
  darkColor,
  type = 'default',
  ...rest
}: ThemedTextProps) {
  const color = useThemeColor({ light: lightColor, dark: darkColor }, 'text')

  return (
    <Text
      style={[{ color }, Fonts[type], style]}
      {...rest}
    />
  )
}
